class Solution {
public:
    int uniquePaths(int m, int n) {
        
        vector<vector<int>> dp(m, vector<int>(n, 0));
        
        for(int row = 0; row < m; row++){
            
            if(row == 0) dp[row][0] = 1;
            else dp[row][0] = dp[row-1][0];

            for(int col = 1; col < n; col++){
                if(row == 0){
                    dp[row][col] = dp[row][col-1];
                }
                else{
                    dp[row][col] = dp[row][col-1] + dp[row-1][col];
                }                
            }
        }


        return dp.back().back();


    }
};